﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <SolidColorBrush x:Key="TabControl_BgColor">White</SolidColorBrush>

    <SolidColorBrush x:Key="TabItem_Selected_BgColor">#FF0000FF</SolidColorBrush>
    <SolidColorBrush x:Key="TabItem_Selected_FgColor">#FF0000FF</SolidColorBrush>
    
    <Style TargetType="{x:Type TabControl}">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel IsItemsHost="True"/>
                        <Border Grid.Row="1" Padding="10" Background="{StaticResource TabControl_BgColor}">
                            <ContentPresenter ContentSource="SelectedContent" 
                                             Name="PART_SelectedContentHost"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="{x:Type TabItem}">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Background" Value="{x:Null}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Padding" Value="5,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border BorderBrush="{StaticResource TabItem_Selected_BgColor}" BorderThickness="0,0,0,0.5" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
                        <Grid x:Name="grid" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="10"/>
                            </Grid.RowDefinitions>
                            <Border x:Name="border" Background="#00000000" CornerRadius="1" Padding="5">
                                <ContentPresenter Content="{TemplateBinding Header}"/>
                            </Border>
                            <Grid Grid.Row="1" x:Name="SelectedFlag" Visibility="Collapsed" VerticalAlignment="Bottom" HorizontalAlignment="Center" >
                                <Path x:Name="path_bg" Grid.Row="1" Stretch="Fill" Fill="{StaticResource TabItem_Selected_BgColor}" Height="9" Width="24" Data="M 0,0 16,0 8,-8 z"/>
                                <Path x:Name="path" Grid.Row="1" Stretch="Fill" Fill="{StaticResource TabControl_BgColor}" Height="8" Width="22" VerticalAlignment="Bottom" HorizontalAlignment="Center" Data="M 0,0 16,0 8,-8 z"/>
                            </Grid>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="SelectedFlag" Property="Visibility" Value="Visible"/>
                            <Setter Property="Foreground" Value="{StaticResource TabItem_Selected_FgColor}"/>
                        </Trigger> 
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>